<template>
  <div>
      <p>你要购买商品的数量：{{shopping}}</p>

      <button v-on:click="shopping=shopping +1">+1</button>

      <button v-on:click="addFn">+1</button>

      <button v-on:click="addCount(5)">+5</button>

      <button v-on:click="subFn">-1</button>
  </div>
</template>

<script>
export default {
    data(){
        return{
            shopping:1
        }
    },
    methods:{
        addFn(){
            this.shopping++
        },
        addCount(num){
               this.shopping = this.shopping + num;
        },
        subFn(){
            this.shopping--
        }
    }
}
</script>

<style>

</style>